package com.zjm.behavioral.iterator;

import java.util.Iterator;

public class ComputerCollege implements College{

    Department[] departments;
    int numOfDepartment = 0;

    public ComputerCollege() {
        departments = new Department[5];
        addDepartment("java专业","java");
        addDepartment("c专业","c");
        addDepartment("c++专业","c++");
        addDepartment("python专业","python");
        addDepartment("go专业","go");
    }

    @Override
    public String getName() {
        return "计算机学院";
    }

    @Override
    public void addDepartment(String name, String desc) {
        Department department = new Department(name, desc);
        departments[numOfDepartment] = department;
        numOfDepartment += 1;
    }

    @Override
    public Iterator createIterator() {
        return new ComputerCollegeIterator(departments);
    }
}
